<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // es5的继承
    //父类 基类
    function Person(name, age) {
      this.name = name
      this.age = age
    }

    Person.prototype.run = function () {
      console.log('跑的快哦');
    }
    // 子类
    function Student(id, name, age) {
      // 构造函数继承
      Person.call(this, name, age)
      this.id = id
    }
    // 原型链继承
    Student.prototype = new Person
    // 修正constructor
    Student.prototype.constructor = Student
    const re = new Student(22, '罗飞', 23)
    console.log(re);
  </script>
</body>

</html>